import request from '@/utils/request'
import type { AddHosSetType, HosListType, HospitalDetailType, HospitalListParamsType, HospitalSetType } from './type'


//1. 医院设置列表
export const reqGetHospitalSet = (page: number, limit: number, hosname: string, hoscode: string) => {
  return request.get<null, HospitalSetType>(
    `/admin/hosp/hospitalSet/${page}/${limit}?hosname=${hosname}&hoscode=${hoscode}`
  )
}


// 2.获取医院列表
export const reqGetHosList = ({ page, limit, ...data }: HospitalListParamsType) => {
  return request.get<null, HosListType>(`/admin/hosp/hospital/${page}/${limit}`, { params: data })
}


// 3.新增医院设置
export const reqAddHosSet = (hospitalSet: AddHosSetType) => {
  return request.post(`/admin/hosp/hospitalSet/save`, hospitalSet)
}

// 4.修改医院设置
export const reqEditHosSet = (hospitalSet: AddHosSetType) => {
  return request.put(`/admin/hosp/hospitalSet/update`, hospitalSet)
}


// 5.删除医院设置
export const reqDelHosSet = (id: number) => {
  return request.delete(`/admin/hosp/hospitalSet/remove/${id}`)
}


// 6.获取医院详情
export const reqGetHosDetail = (id: string) => {
  return request.get<null, HospitalDetailType>(`/admin/hosp/hospital/show/${id}`)
}



export interface StatusType {
  id: string,
  status: number
}
// 7.更新上线状态
export const reqChangeStatus = ({ id, status }: StatusType) => {
  return request.get(`/admin/hosp/hospital/updateStatus/${id}/${status}`)
}




// 8.获取排班规则
export const reqGetScheduleRule = () => {
  return request.get(`/admin/hosp/schedule/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}`)
}


// 9.科室
export const reqDepartment = () => {
  return request.get(`/admin/hosp/department/{hoscode}`)
}